#ifndef __I2C_H
#define __I2C_H

#include "stm32f10x.h"

/*模拟IIC端口输出输入定义*/
#define SCL_H         GPIO_SetBits(GPIOF,GPIO_Pin_6)
#define SCL_L         GPIO_ResetBits(GPIOF,GPIO_Pin_6)

#define SDA_H         GPIO_SetBits(GPIOF,GPIO_Pin_7)
#define SDA_L         GPIO_ResetBits(GPIOF,GPIO_Pin_7)

#define SCL_read      GPIOF->IDR  & GPIO_Pin_6
#define SDA_read      GPIOF->IDR  & GPIO_Pin_7

// #define   uint8_t    unsigned char                  /*!< ITM Stimulus Port 8-bit               */

//IIC所有操作函数
void I2C_delay(void);
void delay5ms(void);
void I2C_Config(void);
int I2C_Start(void);
void I2C_Stop(void);
void I2C_Ack(void);
void I2C_NoAck(void);
int I2C_WaitAck(void); 	 //返回为:=1有ACK,=0无ACK
void I2C_SendByte(uint8_t SendByte); //数据从高位到低位//
unsigned char I2C_RadeByte(void);  //数据从高位到低位//
int Single_Write(unsigned char SlaveAddress, unsigned char REG_Address, unsigned char REG_data);		   //void
unsigned char Single_Read(unsigned char SlaveAddress, unsigned char REG_Address);


#endif


